<template>
  <div class="main-header-box">
    <div class="container">
      <!-- 采用三栏 -->
      <div class="logo">笔<span class="small-font">记屋</span></div>
      <div class="search" @click="goToSearch">
        <div class="search-input">
          <div class="search-logo"></div>
          <div class="search-placehold">搜索</div>
        </div>
      </div>
      <div class="user">
        <div class="avatar"></div>
      </div>
    </div>
  </div>
</template>

<script>
import { defineComponent } from "vue";
import { useRouter } from "vue-router";

export default defineComponent({
  setup() {
    const router = useRouter();
    const goToSearch = () => {
      router.push("/search");
    };

    return {
      goToSearch,
    };
  },
});
</script>

<style scoped>
.main-header-box {
  width: 100%;
  height: 60px;
  border-bottom: 1px solid #f1f1f1;
  display: flex;
}

.container {
  width: 100%;
  height: 100%;
  margin: 0 8px;
  display: flex;
}

.logo {
  width: 30%;
  height: 100%;
  text-align: center;
  line-height: 60px;
  font-size: 18px;
  font-family: "Times New Roman", "Arial Narrow", Arial, sans-serif;
  font-weight: 500;
}

.logo .small-font {
  font-size: 14px;
}

.search {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
}

.search-input {
  width: 70%;
  height: 38%;
  border: none;
  background-color: #f4f5f5;
  display: flex;
  align-items: center;
  border-radius: 5% / 50%;
  margin-left: 5%;
}

.search-logo {
  width: 10%;
  height: 80%;
  background: url("~@/assets/images/icon/search.png") no-repeat;
  background-size: contain;
  margin: 0 5%;
}

.search-placehold {
  font-size: 12px;
  font-weight: 300;
}

.user {
  width: 30%;
  min-width: 50px;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.avatar {
  width: 40px;
  height: 40px;
  background: url("~@/assets/images/avatar.png") no-repeat;
  background-size: contain;
  border-radius: 50%;
}
</style>
